package com.party.core.dao.read.charge;

import com.party.common.paging.Page;
import com.party.core.dao.read.BaseReadDao;
import com.party.core.model.charge.PackageMember;
import com.party.core.model.charge.PackageMemberWithAuthor;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 等级和用户的中间表
 */
@Repository
public interface PackageMemberReadDao extends BaseReadDao<PackageMember> {

    List<PackageMember> newListPage(@Param("pMember") PackageMember packageMember, @Param("params") Map<String, Object> params);

    /**
     * 获取最高等级的套餐关系
     *
     * @param packageMember 套餐关系
     * @param params
     * @return
     */
    PackageMember getMaxPackageRole(@Param(value = "pMember") PackageMember packageMember, @Param("params") Map<String, Object> params);


    List<PackageMember> getPackageMemberByType(@Param("memberId") String memberId, @Param("type") int type, Page page);

    /**
     * 根据订单id获取关系
     *
     * @param orderId 订单id
     * @return
     */
    PackageMember findByOrderId(@Param(value = "orderId") String orderId);

    /**
    * @Description:系统购买列表
    * @Param:
    * @return:
    * @Author: Hua Qunhao
    * @Date: 2019/5/23
    */
    List<PackageMember> systemBuyList(@Param(value = "packageMember")PackageMember packageMember,Page page);

    /**
    * @Author yifeng
    * @Description admin系统订单列表
    * @Date 17:37 2019/5/24
    * @param packageMember
    * @param params
    * @param page
    * @return
    **/
    List<PackageMemberWithAuthor> packageMemberWebList(@Param(value = "packageMember") PackageMember packageMember,
                                                       @Param("params") Map<String, Object> params, Page page);

    /**
     * @Author hzq
     * @Description //根据memberId获取最近支付成功的packageMember
     * @Date 13:44 2019/5/30
     * @param memberId 机构id
     * @return
     **/
    List<PackageMember> getLatelyPaySuccess(String memberId);
}
